#include <LoggingArgumentHandler.h>
#include <Logging.h>

using namespace CommandLineProcess;
using namespace logging;

namespace handlers {

LoggingArgumentHandler::LoggingArgumentHandler(Tag& aTag, string& aDescription)
		: ArgumentHandler(aTag, aDescription) {
}

bool LoggingArgumentHandler::handleArgument(string& argument) {
	Level theLoggingLevel = INFO;
	LoggerFactory::getInstance().setApplicationLevel(theLoggingLevel);
	if (argument == "inspection") theLoggingLevel = TRACE;
	else if (argument == "verbose") theLoggingLevel = DEBUG;
	else if (argument == "normal") theLoggingLevel = INFO;
	else if (argument == "errors-only") theLoggingLevel = ERROR;
	else if (argument == "off") theLoggingLevel = OFF;
	else return false;
	LoggerFactory::getInstance().setApplicationLevel(theLoggingLevel);
	return true;
}

LoggingArgumentHandler::~LoggingArgumentHandler() {
}


}
